from django.db import models
from realize.models.category.StationCategory import StationCategory
from realize.models.FaStation import FaStation

class Station(models.Model):
    name = models.CharField(max_length=100, verbose_name="台站名称")
    location = models.CharField(max_length=200, verbose_name="经纬坐标")

    address = models.CharField(max_length=200, verbose_name='地址信息')

    attach = models.ForeignKey(FaStation, verbose_name='所属基站', on_delete=models.CASCADE, blank=True, null=True)
    category = models.ForeignKey(StationCategory,verbose_name='站台类型', on_delete=models.CASCADE, blank=True, null=True)

    signal_type = models.CharField(max_length=50, verbose_name='信号类型')
    frequency = models.IntegerField(max_length=50, verbose_name='频率/MHz')
    transmit_power = models.FloatField(verbose_name='发射功率')
    antenna_height = models.FloatField(verbose_name='天线高度/m')
    coverage_range = models.FloatField(verbose_name='覆盖范围/km')

    device_model = models.CharField(max_length=100, verbose_name='设备型号|厂家信息')
    device_status = models.CharField(max_length=50, verbose_name='设备状态')
    alarm_status = models.CharField(max_length=50, verbose_name='警告状态')
    updated_at = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    def __str__(self):
        return f"台站： {self.name}"

    class Meta:
        verbose_name_plural = '台站 - Station'
